﻿using System.IO;
using Viyi.Util.Linq;

namespace Signit.Sdk.Extentions
{
    public static class StreamExtention
    {
        public static T Write<T>(this T stream, byte[] data)
            where T : Stream
        {
            stream.Write(data, 0, data.Length);
            return stream;
        }

        public static T Write<T>(this T stream, byte[] data, byte[] suffix)
            where T : Stream
        {
            stream.Write(data);
            stream.Write(suffix);
            return stream;
        }

        public static T Write<T>(this T stream, params byte[][] multiData)
            where T : Stream
        {
            multiData.ForEach(data => stream.Write(data));
            return stream;
        }
    }
}
